<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        .box {
            width: 400px;
            border-bottom: 1px solid;
            border-color: rgb(177, 177, 177);
            margin: 100px auto;
            position: relative;
        }

        .box input {
            width: 370px;
            height: 30px;
            border: 0;
            outline: none;

        }

        .box img {
            position: absolute;
            top: 7px;
            right: 5px;
            width: 24px;
        }
    </style>
</head>

<body>
    <div class="box">
        <label for="">
            <img src="img/07显示隐藏时间/不可见.png" alt="" id="eye">
        </label>
        <input type="password" name="" id="pwd">
    </div>


    <div></div>

    <script>
        var eye = document.getElementById("eye");
        var pwd = document.getElementById("pwd");
        var flag = 0;
        eye.onclick = function () {

            if (flag == 0) {
                pwd.type = "text";
                eye.src = "img/07显示隐藏时间/可见.png";
                flag = 1;
            } else {
                pwd.type = "password";
                eye.src = "img/07显示隐藏时间/不可见.png";
                flag = 0;
            }


        }



    </script>
</body>

</html>